package com.example.boss.pinkdiary;

import com.example.boss.db.gen.diaryTag;
import com.example.boss.db.gen.diaryTagDao;

import java.util.List;

/**
 * Created by 打好boss on 2018/6/16.
 */

public class diaryTagDaoHelper {
    static private diaryTagDao dtd;
    public diaryTagDaoHelper(diaryTagDao dtd){
        this.dtd=dtd;
    }
    public static void deleteByTag(String tag){
        dtd.queryBuilder().where(diaryTagDao.Properties.Tag.eq(tag)).buildDelete().executeDeleteWithoutDetachingEntities();
    }
    public static int judgeByTag(String tag){
        Long num=dtd.queryBuilder().where(diaryTagDao.Properties.Tag.eq(tag)).count();
        if(num==0){
            return 0;
        }
        else return 1;
    }
}
